<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>我的订单-${setting.name}</title>
    [#include "/common/include.ftl"]
	[#import "/common/pagination.ftl" as p/]
    <link rel="styleSheet" href="${base}/resource/css/member.css">
    <script src="${base}/resource/js/order.js"></script>
    <script src="${base}/resource/js/order.module.js"></script>
</head>
<body class="customer">
    [#include "common/header.ftl"]
    <div class="crumbs">
        <a href="${base}/member/index.jhtml">会员中心</a>
		<i style='font-family: simsun;font-style: normal;'>></i>
		<a href="#">交易管理</a>
		<i style='font-family: simsun;font-style: normal;'>></i>
		<a href="#">我的订单</a>
    </div>
    <div id="member-main">
		[#assign menuNo = 'myOrder'/]
        [#include "/common/member-left.ftl"/]

        <div class="member-right">
            <div class="right-wrap">
                <h2 class="right-title">我的订单</h2>
                <div class="member-order">
                    <form id="searchOrderForm" action="${base}/order/list.jhtml">
	                    <div class="list-header">
	                        <div class="order-search fr">
	                            <div class="has-clean fl">
	                                <input type="text" name="keyword" value="${keyword}" placeholder="订单查询" class="hp-input"><i class="clean">x</i>
	                            </div>
	                            <a class="hp-button fl" onclick="$('#searchOrderForm').submit();">查询</a>
	                            <div class="clear"></div>
	                        </div>
	                    </div>
	                    <div class="clear"></div>
	                    <table class="member-table-list" id="order-list">
	                        <tr>
	                            <th width="30%">订单编号</th>
	                            <th width="10%">收货人</th>
	                            <th width="15%">订单金额</th>
	                            <th width="20%">
	                                <select name="type" onchange="$('#searchOrderForm').submit();">
	                                    <option value="1" [#if type=1]selected=selected[/#if]>最近一个月</option>
	                                    <option value="2" [#if type=2]selected=selected[/#if]>一个月以前</option>
	                                </select>
	                            </th>
	                            <th width="10%">
	                                <select name="status" onchange="$('#searchOrderForm').submit();">
	                                    <option value="">全部</option>
	                                    <option value="0" [#if status=0]selected=selected[/#if]>待付款</option>
	                                    <option value="1" [#if status=1]selected=selected[/#if]>待发货</option>
	                                    <option value="2" [#if status=2]selected=selected[/#if]>待收货</option>
	                                    <option value="3" [#if status=3]selected=selected[/#if]>已完成</option>
	                                    <option value="4" [#if status=4]selected=selected[/#if]>交易关闭</option>
	                                </select>
	                            </th>
	                            <th>操作</th>
	                        </tr>
	
	                    [#if pager?? && pager.list?has_content]
	                        [#list pager.list as order]
							<tr>
								<td colspan="6" class="ti">
									<span>订单编号：</span><a target="_blank" href="${base}/order/detail.jhtml?orderNo=${order.orderNo}">${order.orderNo}</a>
	                               [#-- <a style="float: right;margin-right: 10px" href="#">还要买</a>--]
								</td>
							</tr>
							<tr class="p-l">
								<td class="p-img">
	                                [#list order.items as item]
	                                    [#if item_index < 4]
	                                    <a href="${base}/goods/${item.goodsId}.jhtml" target="_blank">
	                                        <img alt="${(item.productName)!''}" title="${(item.productName)!''}" class="lazy" data-original="[@Pic pic=item.image!'' postfix='50x50'/]" postfix="50x50" width="50" height="50">
	                                    </a>
	                                    [/#if]
	                                [/#list]
								</td>
								<td>${order.consignee}</td>
								<td>
									<p>${currency(order.totalAmount, true)}</p>
									<p>${message("PayType."+order.payType)}</p>
								</td>
								<td>${order.createDate?date}</td>
								<td>
									[#if order.orderStatus = 'waitBuyerPay']
	                            		等待买家付款
	                                [#elseif order.orderStatus = 'waitSellerSendGoods']
										正在发货
	                                [#elseif order.orderStatus = 'waitBuyerConfirmGoods']
	                            		已发货
	                                [#elseif order.orderStatus = 'tradeFinished']
										交易完成
	                                [#elseif order.orderStatus = 'tradeClosed']
										交易关闭
	                                [/#if]
								</td>
								<td>
									[#assign data = "{orderId: '${order.id}', orderNo:'${order.orderNo}',status:'${order.orderStatus}',hasRefund:'${order.hasRefunded}'}" /]
	                                [#if order.orderStatus = 'waitBuyerPay']
	                                    <a data="${data}" class="onlile-payment" href="javascript:">在线支付</a>
										<span>|</span>
	                                    <a data="${data}" class="cancel-order" href="javascript:">取消</a>
	                                [#elseif order.orderStatus = 'waitSellerSendGoods']
                                        [#if !order.hasRefunded ]
                                            <a data="${data}" class="order-refund" href="javascript:">申请退换货</a>
                                        [#else]
                                            <a data="${data}" class="order-refund-detail" href="javascript:">退换货详情</a>
                                        [/#if]
	                                [#elseif order.orderStatus = 'waitBuyerConfirmGoods']
	                                    <a data="${data}" class="wait-buyer-confirm-goods" href="javascript:">确认收货</a>
                                        [#if order.hasRefunded ]
                                            <br/>
                                            <a data="${data}" class="order-refund-detail" href="javascript:">退换货详情</a>
                                        [/#if]
	                                [#elseif order.orderStatus = 'tradeFinished']
	                                    <a data="${data}" class="order-comment" href="javascript:">评价</a>
										<span>|</span>
	                                    <a data="${data}" class="delete-order" href="javascript:">删除</a>
                                        [#if !order.hasRefunded ]
                                            <br/>
                                            <a data="${data}" class="order-refund" href="javascript:">申请退换货</a>
                                        [#else]
                                            <br/>
                                            <a data="${data}" class="order-refund-detail" href="javascript:">退换货详情</a>
                                        [/#if]
	                                [#elseif order.orderStatus = 'tradeClosed']
										[#if order.hasRefunded ]
                                            <a data="${data}" class="order-refund-detail" href="javascript:">退换货详情</a>
										<br/>
										[/#if]
	                                    <a data="${data}" class="delete-order" href="javascript:">删除</a>
	                                [/#if]
	
	                                <br> <a target="_blank" href="${base}/order/detail.jhtml?orderNo=${order.orderNo}">订单详情</a>
	
								</td>
							</tr>
	                        [/#list]
	                    [#else]
	                        <tr>
	                            <td colspan="6" class="list-empty">暂无订单</td>
	                        </tr>
	                    [/#if]
	                    </table>
                    </form>
					<table class="member-table-list">
						<tr>
						    <td colspan="6">
						    [@p.pager pager = pager url = "${base}/order/list.jhtml"/]
						    </td>
						</tr>
					</table>
                </div>
            </div>
        </div>
        <div class="clear"></div>
    </div>
	[#include "common/footer-slidebar-lazyload.ftl"]
</body>
</html>